/************************************************************
 * Copyright (C), 2022-2030, ripnano. Co., Ltd.
 * FileName:        form_setting_language.h
 * Author:          Dan Yin
 * Date:            2023-06-21
 * Description:     the class of language setting window
 * Version:         1.0.0.0
 **********************************************************/

#ifndef FORM_SETTING_LANGUAGE_H
#define FORM_SETTING_LANGUAGE_H

// add necessary includes here
#include "ui/defines/global.h"

namespace Ui {
class FormSettingLanguage;
}

class FormSettingLanguage : public QWidget
{
    Q_OBJECT

public:
    // Get an instance of "FormSettingLanguage" class, if exist, return it
    static FormSettingLanguage* getInstance(QWidget *pParent = nullptr);

signals:
    // The signal that refresh UI info
    void signalRefreshUI();

    // Switch the language(English/Chinese)
    void signalSwitchLanguage(int eumLangType);

private slots:
    // Choose Chinese as the default language
    void on_pushButton_Chinese_clicked();

    // Choose English as the default language
    void on_pushButton_English_clicked();

    // The slot that refresh UI info
    void slotRefreshUI();

protected:
    // Triggers an event before it is switch language
    void changeEvent(QEvent *event);

private:
    // The default constructor
    explicit FormSettingLanguage(QWidget *parent = nullptr);

    // The default destructor
    virtual ~FormSettingLanguage();

    // After constructing object, initialize the object
    void _initialze();

    // Init the window style
    void _initUi();

    // Save the current language
    void _saveLanguageType();

private:
    Ui::FormSettingLanguage *ui;
};

#endif // FORM_SETTING_LANGUAGE_H
